public static <T> T inflate(ResultSet rs, Class<T> clas) throws InstantiationException, IllegalAccessException,  
        IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {  
    T ins = clas.newInstance();  
    Field[] fields = ins.getClass().getDeclaredFields();  
    for (Field field : fields) {  
        field.setAccessible(true);  
        try {  
            Object object = rs.getObject(field.getName());  
            if (null != object) {  
                field.set(ins, object);  
            }  
        } catch (SQLException e) {  
            // do next field  
        }  
    }  
    return ins;  
}  